home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 018a / amac41.zip / TOGL14.QM < prev    next >
Text File  |  1991-07-18  |  16KB  |  377 lines

  1. *                                  TOGL14.QM
  2. *                            Written by Tom Hogshead
  3. *         With Macro Contributions by John Goodman and Steve Watkins
  4. *                                July 18, 1991
  5. *
  6. * ┌───────────────────────────────[ (INDEX) ]────────────────────────────────┐
  7. * │
  8. * │               Macro                                          (1)  Bytes
  9. * │ @(1) Force Insert Mode to ON                                 JG     17
  10. * │ @(9) Force Insert Mode to ON (alternate version)             TH     16
  11. * │ @(a) Force Insert Mode to ON (alternate version)             SW     23|new
  12. * │ @(b) Force Insert Mode to OFF                                SW     23|new
  13. * │ @(2) Force EnterMatching Mode to ON                          JG     17
  14. * │ @(3) Force AutoIndent Mode to ON                             JG     25
  15. * │ @(4) Force WordWrap Mode to ON                               JG      6
  16. * │ @(5) Force WordWrap Mode to OFF                              JG      7
  17. * │ @(6) Force BoxDraw Mode to ON                                JG     19
  18. * │ @(7) Prompt User for Desired Insert Mode State (1=ON, 0=OFF) JG     21
  19. * │ @(8) Force Backups OFF                                       TH     50
  20. * │ @(h) Select Index item with cursor line, then <enter>.       TH     22
  21. * │
  22. * │(Index) Use      - How to locate macro or item below from Index using @h
  23. * │(Description)    - Search/Replace Macros
  24. * │(Startup)        - What's required
  25. * │(Macros)
  26. * │(Other) Macros   - not included             (1) Authors: TH-Tom Hoghsead
  27. * │(Version) history                                        JG-John Goodman
  28. * │                                                         SW-Steve Watkins
  29. * └────────[ be sure to leave at least one blank line at end of Index  ]─────┘
  30.  
  31. * (Description):
  32. *
  33. * TOGL14.QM contains QEdit macros to toggle Insert, AutoIndent,
  34. * WordWrap, EnterMatching and BoxDraw ON, and Backups OFF.
  35.  
  36. * (Index) Use;
  37. *
  38. * To locate a macro or item in this file, press @h, place the cursor
  39. * line on the desired item in the Index above, and press <enter>.
  40. * See BOOKxx.QM for more details.
  41.  
  42. * These macros require "QEdit and QMAC v2.1, February, 1990" or later.
  43.  
  44. * (Startup):
  45. *
  46. * To BEGIN, just type "START TOGL" <Enter>. All pertinent files will be
  47. * loaded in the "Ring" for viewing, and TOGL14.MAC is read.
  48. * Alternatively, type "START TOGL 0" <Enter> and the disk copies of all
  49. * files in the "Ring" will be loaded ready for editing, saving time.
  50.  
  51. * For (other) macros, see ALLMACRO.INF.
  52.  
  53. * (Macros)...................................
  54. *
  55. * =========================================================================
  56. * Date: 04-18-91 (17:50)           Number: 232-233      SemWare Support BBS
  57. *   To: TOM HOGSHEAD               Refer#: NONE
  58. * From: JOHN GOODMAN                 Read: NO
  59. * Subj: TOGGLE ON                    Conf: 3 Macros
  60. * ------------------------------------------------------------------------
  61. *
  62. * This file contains QEdit macros that perform functions similar to
  63. * those in Tom Hogshead's TOGL12.QM file included in the AMACxx.ZIP
  64. * file. The following macros may be used to force toggle modes to
  65. * either ON or OFF regardless of their original state.  Macros are
  66. * provided to toggle Insert mode, EnterMatching mode, AutoIndent mode,
  67. * WordWrap mode, and BoxDraw mode. Each of the macros will return the
  68. * cursor to its original position after execution and should be
  69. * reasonably tolerant of, and not modify, any other existing mode
  70. * states or configuration settings.
  71. *
  72. * The last macro (@7) is an alternate version of the first macro
  73. * (@1) that prompts the user to indicate whether they want Insert mode
  74. * ON or OFF.  Entering a 1 (one) at the prompt turns Insert mode ON;
  75. * entering a 0 (zero) turns Insert mode OFF. This technique can be
  76. * used with any of the other toggle macros and adds only 4 bytes to
  77. * the macro size!
  78. *
  79. * John Goodman (Author)
  80.  
  81. * 
  82. * @(1) Force Insert Mode to ON
  83. *-------------------------------------------------------
  84. * The following macro toggles insert mode ON if it was previously OFF.
  85. * The macro takes advantage of the fact that the Backspace command
  86. * will delete a single-character block if insert mode is on, but will
  87. * leave the block intact if insert mode is off. To make the macro
  88. * always toggle insert mode OFF, change JFalse to JTrue.
  89.  
  90. @1  MacroBegin
  91.     UnmarkBlock         * Ensure No Blocks Marked
  92.     InsertLine          * Insert a Test Line
  93.     DropAnchor          * Start a Character Block
  94.     "a"                 * Type Any Character
  95.     MarkCharacter       * End Block for Just That Character
  96.     BackSpace           * Backspace Over the Block
  97.     GotoBlockBeg        * Test If Block Still Existing
  98.  JFalse CLEANUP:        * Ins Mode Deletes Block; Overstrike Doesn't
  99.     ToggleInsert        * Toggle Insert On If Block Still There
  100.  CLEANUP:
  101.     DelLine             * Remove Test Line; Cursor at Orig Position
  102. * 17 bytes Wed  04-17-1991  22:42:57
  103.  
  104. * 
  105. * @(2) Force EnterMatching Mode to ON
  106. * ----------------------------------------------
  107. * The following macro toggles EnterMatching mode ON if it was
  108. * previously OFF. To make the macro always toggle EnterMatching mode
  109. * OFF, change JTrue to JFalse.
  110.  
  111. @2  MacroBegin
  112.     UnmarkBlock          * Ensure No Blocks Marked
  113.     InsertLine           * Insert a Test Line
  114.     DropAnchor           * Start a Block to Retain Cursor Pos
  115.     "("                  * Type an Open Char to be Matched
  116.     DropAnchor           * End the Block
  117.     EndLine              * Try Moving to EOL: Cursor will move
  118.  JTrue CLEANUP:          *  only if matching char auto entered
  119.     ToggleEnterMatching  * Toggle EnterMatching ON
  120.  CLEANUP:
  121.     GotoBlockBeg         * Return to Original Cursor Pos
  122.     DelLine              * Remove Test Line; Cursor at Orig Pos
  123. * 17 bytes Wed  04-17-1991  22:43:21
  124.  
  125. * 
  126. * @(3) Force AutoIndent Mode to ON
  127. *------------------------------------------------
  128. * This macro toggles AutoIndent mode ON if it was previously OFF. This
  129. * macro takes advantage of the fact that entering a carriage return
  130. * with AutoIndent ON will indent the new line, whereas the cursor will
  131. * be placed at the beginning of the line if AutoIndent is OFF.  To
  132. * make the macro always toggle AutoIndent mode OFF, change JTrue to
  133. * JFalse.
  134.  
  135. @3  MacroBegin
  136.     UnmarkBlock           * Ensure No Blocks Marked
  137.     InsertLine            * Insert 1st Blank Line
  138.     DropAnchor DropAnchor * Set Block to Retain Cursor Pos
  139.     InsertLine            * Insert 2nd Blank Line
  140.     BegLine               * Go to Start of Line in case WW ON
  141.     CursorRight "a"       * Move to 2nd Col and Type Char
  142.     Return                * Type CR (creates 3rd line if Ins ON)
  143.     BegLine               * Try Moving to BOL: If Indent OFF,
  144.  JTrue CLEANUP:           *  Cursor will already be at BOL
  145.     ToggleIndent          * Toggle AutoIndent ON
  146.  CLEANUP:
  147.     CursorUp              * Move Cursor to 1st Line
  148.     DropAnchor            * Reset Beg Block Position
  149.     GotoBlockEnd          * Go to End of Block
  150.     CursorDown            * Move Out of Block and Back to
  151.     CursorLeft            *  Original Cursor Position
  152.     DeleteBlock           * Delete the Mess We Created
  153. * 25 bytes Wed  04-17-1991  22:44:32
  154.  
  155. * 
  156. * @(4) Force WordWrap Mode to ON
  157. *-------------------------------------------------
  158. * This macro toggles WordWrap mode ON if it was previously
  159. * OFF.  This macro takes advantage of the fact that setting
  160. * the right margin, even to its default value, automatically
  161. * turns WordWrap mode ON.
  162.  
  163. @4  MacroBegin           * Simply Set Right Margin and Accept
  164.     SetRMargin Return    * the Current Setting!
  165. * 6 bytes Wed  04-17-1991  22:45:21
  166.  
  167. * 
  168. * @(5) Force WordWrap Mode to OFF
  169. *-------------------------------------------------
  170. * This macro toggles WordWrap mode OFF if it was previously
  171. * ON.  The macro first forces WordWrap ON by setting the
  172. * right margin to its current default setting (as in @4 above),
  173. * then toggles it to its opposite state (OFF).
  174.  
  175. @5  MacroBegin
  176.     SetRMargin Return    * Force WordWrap ON
  177.     ToggleWordWrap       * Toggle it OFF!
  178. * 7 bytes Wed  04-17-1991  22:45:55
  179.  
  180. * 
  181. * @(6) Force BoxDraw Mode to ON
  182. *--------------------------------------------------
  183. * Basically the same as @2.  Going CursorLeft with BoxDraw ON
  184. * leaves a boxdraw character behind.
  185.  
  186. @6  MacroBegin
  187.     UnmarkBlock          * Basically the same logic as @(2)
  188.     InsertLine
  189.     DropAnchor
  190.     "a"
  191.     DropAnchor
  192.     CursorRight
  193.     CursorLeft           * This will leave an extra char behind if
  194.     EndLine              * BoxDraw ON; EndLine tests for it
  195.  JTrue CLEANUP:
  196.     ToggleBoxDraw
  197.  CLEANUP:
  198.     GotoBlockBeg
  199.     DelLine
  200. * 19 bytes Wed  04-17-1991  22:46:33
  201.  
  202. * 
  203. * @(7) Prompt User for Desired Insert Mode State (1=ON, 0=OFF)
  204. *-------------------------------------------------------------
  205. * This is an alternate version of @1 that prompts the user
  206. * for the desired Insert mode state. Entering 1 (or any odd
  207. * number) at the prompt turns Insert mode ON; entering 0 (or
  208. * any even number) turns Insert mode OFF.  Note additional
  209. * four commands at the end of the macro.
  210.  
  211. @7  MacroBegin
  212.     UnmarkBlock         * Ensure No Blocks Marked
  213.     InsertLine          * Insert a Test Line
  214.     DropAnchor          * Start a Character Block
  215.     "a"                 * Type Any Character
  216.     MarkCharacter       * End Block for Just That Character
  217.     BackSpace           * Backspace Over the Block
  218.     GotoBlockBeg        * Test If Block Still Existing
  219.  JFalse CLEANUP:        * Ins Mode Deletes Block; Overstrike Doesn't
  220.     ToggleInsert        * Toggle Insert ON If Block Still There
  221.  CLEANUP:
  222.     DelLine             * Remove Test Line; Cursor at Orig Position
  223.  *-- Added Lines for ON/OFF Prompting
  224.     ToggleInsert        * Mode is Now ON, Turn it OFF
  225.     RepeatCmd           * Prompt User for ON/OFF
  226.     Pause               * Odd# = ON, Zero or Even# = OFF
  227.     Return              * Finish Prompt for User
  228. * 21 bytes Wed  04-17-1991  22:47:05
  229.  
  230. * 
  231. *-----------------------------------------------------
  232. * @(8) Toggle backups OFF if ON, Tom Hogshead, author
  233. *-----------------------------------------------------
  234. * Change "c:" to ramdrive for faster operation.
  235. *
  236. @8  MacroBegin                          *
  237.     EditFile "c:!" Return               * Edit temp file
  238.     BegFile                             * TOF if temp file is loaded
  239.     MarkBlockBegin EndFile MarkBlockEnd * Mark file to delete all of it
  240.     DeleteBlock  Insertline             * Delete it! Make 2 line file
  241.     SaveFile SaveFile                   * Save twice to make backup if
  242.                                         * backups toggled ON
  243.     Killfile Quit                       * Kill/quit c:!
  244.     EditFile "c:!.bak" Return           * Load c:!.bak
  245.     Newfile Return                      * Exit and Edit c:!.bak
  246.     Gotoline "2" Return                 * Try to go to line 2
  247.     jfalse BAKOFF:                      * If line 2 not found, backups was OFF
  248.                                         * Test is false, go to BAKOFF
  249.                                         * ELSE backups was ON,
  250.     Togglebakups                        * and toggle backups OFF
  251.  BAKOFF:                                *
  252.     Killfile Quit                       * Kill/quit c:!.bak
  253. *
  254. * 50 bytes Tue  02-12-1991  12:14:46
  255.  
  256. * 
  257. *--------------------------------------------
  258. * @(9) toggles Insert ON, Tom Hogshead author
  259. *--------------------------------------------
  260. *
  261. * This macro is based on an alternate slightly longer version written
  262. * by Kyle Watkins of SemWare. It is included here to show an
  263. * alternate technique. It has the disadvantage of moving the cursor
  264. * one space right when running.
  265. *
  266. @9 macrobegin
  267.         insertline                     * insert test line
  268.         "a" cursorleft "a"             * insert "aa"
  269.         endline                        * if not at endline-insert is on
  270.  jtrue END:                            * if at endline    -insert is off
  271.         toggleinsert                   * toggle on if off
  272.  END:                                  *
  273.         delline                        * delete test line
  274. *
  275. * 16 bytes Fri  07-27-1990  22:44:42
  276.  
  277. * =======================================================================
  278. *  BBS: SemWare Support BBS
  279. * Date: 05-23-91 (09:22)             Number: 14090
  280. * From: STEVE WATKINS                Refer#: NONE
  281. *   To: FRED BRUCKER                  Recvd: NO
  282. * Subj: INSERT MODE                    Conf: (0) Main Board
  283. * -----------------------------------------------------------------------
  284. * Here are some macros which allow you to turn the insert on or off.
  285.  
  286. * Note: Both of the following macros assume you do not use the "nul" file
  287. * (I use is as a place marker).  I have a work-around if necessary.
  288.  
  289. * Turn macro on (use toggle_insert to turn off - or the macro below)
  290.  
  291. * 
  292. * ----------------------------------------------------------------------
  293. * @(a) Force Insert Mode to ON
  294. * ----------------------------------------------------------------------
  295.  
  296. @a  macrobegin
  297.     editfile "nul" return
  298.     '-'
  299.     cursorleft
  300.     '-'
  301.     endline
  302.     jTrue done
  303.     toggle_insert
  304.   done:
  305.     quit
  306. * 23 bytes Thu  05-23-1991  17:12:43 (TH line added)
  307.  
  308. * Turn macro off
  309.  
  310. * 
  311. * ----------------------------------------------------------------------
  312. * @(b) Force Insert Mode to OFF
  313. * ----------------------------------------------------------------------
  314.  
  315. @b  macrobegin
  316.     editfile "nul" return
  317.     '-'
  318.     cursorleft                  * cursorleft
  319.     '-'
  320.     endline
  321.     jFalse done
  322.     toggle_insert
  323.   done:
  324.     quit
  325. * 23 bytes Thu  05-23-1991  17:12:33 (TH line added)
  326.  
  327. * Let us know if we can be of any further assistance.
  328.  
  329. * Steve Watkins
  330. * SemWare Technical Support
  331. * -----------------------
  332.  
  333. * Tom Hogshead comment about @a and @b:
  334.  
  335. * The techniques used in @a and @b have the advantage that the block
  336. * condition and current file edit status is not changed. Screen
  337. * changes are also slightly less than with my and John Goodman's
  338. * techniques. Size of @a and @b is 6 to 7 bytes larger than @1 and @9.
  339.  
  340. * 
  341. * ----------------------------------------------------------------------
  342. * @(h) Finds first word on cursor line marked in document below
  343. * ----------------------------------------------------------------------
  344. *
  345. * Press @ and h at the same time. Cursor down to desired line in Index.
  346. * Press <enter> to locate the desired item from the Index. See
  347. * Bookxx.Qm in AMACxx.Zip for more discussion. Tom Hogshead, author.
  348. *
  349. @h macrobegin
  350.         begfile
  351.         unmarkblock
  352.         markline markline
  353.         pause
  354.         wordright
  355.         markword
  356.         copy
  357.         endpara
  358.         find "(" paste ")"  return return
  359.         begline
  360. *
  361. * 22 bytes Tue  04-09-1991  16:23:53
  362.  
  363. * (Version) History:
  364. *       1.0     Initial version, Alt9 & 0
  365. *       1.1     Alt_6,7 & 8 added
  366. *       1.1a    Changed file name TOGGLE11 to TOGL11.
  367. *       1.1b    Modified this file documentation.
  368. *       1.1c    Modified this file documentation and added START.BAT.
  369. *               Changed TOGGLE file names to TOGL.
  370. *       1.2     Added @5 toggle Backups OFF.
  371. *       1.3     Removed @6-@8 and @0
  372. *               Changed @5 key to @8
  373. *               Added @1-@7 by John Goodman
  374. *       1.4     Added @a and @b by Steve Watkins.
  375.  
  376. * Tom Hogshead
  377.